package com.jyh.controller;


import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.jyh.config.redis.JedisClient;
import com.jyh.entity.Student;
import com.jyh.service.IStudentService;

/**
 * Created by Administrator on 2017/3/1 14:55.
 */
@Controller
public class TestController {
	@Autowired
	private JedisClient jedisClientPool;
	@Autowired
	private IStudentService studentService;
	
	@RequestMapping(value="test")
	public void getTest(){
		List<Student> list = studentService.likeName("小明123s");
		System.out.println(list);
	}
	
	
	// 添加
	@RequestMapping(value = "/add", method = RequestMethod.GET)
	@ResponseBody
	public void test() {
		System.out.println("start.....");
		String key = "repayment_entrust_key_" + "111111";
		// 获取
		String string = jedisClientPool.get(key);
		if (string != null) {
			System.out.println("已经在处理中，请稍后。");
		}
		// 插入
		jedisClientPool.set(key, "1");

	}

	

	// 删除
	@RequestMapping(value = "/remove", method = RequestMethod.GET)
	@ResponseBody
	public void remove() {
		// 删除KEY
		String key = "repayment_entrust_key_" + "111111";
		jedisClientPool.del(key);
		System.out.println("add success end...");
	}

	@RequestMapping("/LoginTest")
	public ModelAndView page1(){
		// 页面位置 /WEB-INF/jsp/page/page.jsp
		ModelAndView mav = new ModelAndView("aaa");
		return mav;
	}
}